import { request } from '@/utils/request'
import type { User, CodeType } from '@/types/user'

// 密码登录的接口 -- loginByPasswordRequest
export const loginByPassword = (password: string, mobile: string) => {
    // request<User>('login/password', 'POST', { password, mobile })
    return request<User>('login/password', 'POST', { password, mobile })
}

// 根据code登录的接口
export const loginByCode = (code: string, mobile: string) => {
    return request<User>('login', 'POST', { code, mobile })
}

// 获取验证码的接口
export const sendMobileCode = (mobile: string, type: CodeType) => {
    return request('code', 'GET', { mobile, type })
}

// 短信登录
export const loginByMobile = (mobile: string, code: string) =>
    request<User>('/login', 'POST', { mobile, code })
